package com.edie.customview.modular.mymvp;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.view.MenuItem;

import com.edie.customview.R;
import com.edie.customview.basemvp.BaseActivity;

/**
 * - @Description:  mvp封装
 * - @Author:  edie
 * - @Time:  2018/7/19 上午10:02
 */
public class MvpActivity extends BaseActivity implements BottomNavigationView.OnNavigationItemSelectedListener {


    public static void start(Context context) {
        context.startActivity(new Intent(context, MvpActivity.class));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_mvp);

        BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
        navigation.setOnNavigationItemSelectedListener(this);
    }

    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        switch (item.getItemId()) {
            case R.id.navigation_home:
                getSupportFragmentManager().beginTransaction()
                        .replace(R.id.connect_fl, new HomeFragment(), "home")
                        .commit();
                return true;
            case R.id.navigation_dashboard:
                return true;
            case R.id.navigation_notifications:
                return true;
        }
        return false;
    }
}
